home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / HARDWARE.SWG / 0002_ALOCSIZE.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  3KB  |  75 lines

  1. *--*  03-31-93  -  21:47:03  *--*
  2. /. Date: 03-30-93 (23:45)              Number: 24023 of 24035
  3.   To: PEDRO PACHECO                 Refer#: 23957
  4. From: ERIC LU                         Read: NO
  5. Subj: allocation Units              Status: PUBLIC MESSAGE
  6. Conf: R-TP (552)                 Read Type: GENERAL (A) (+)
  7.  
  8. PP>> Is there any way to find (in Pascal) what's de size of each allocation uni
  9. PP>> in a Hard drive?
  10.  
  11. Pedro,
  12.      See if the following is what you wanted...
  13.  
  14. -------------------------------- Cut  ----------------------------------
  15.  
  16. Program Int21_36;
  17. Uses Crt,Dos;
  18. Procedure DiskfreeSpace( DriveCode: Byte);
  19. Var
  20.    Regs: Registers;
  21.    SectorsPerCluster,
  22.    AvailableClusters,
  23.    BytesPerSector,
  24.    ClustersPerDrive,
  25. (63 min left), (H)elp, More?    AllocationSize,
  26.    Capacity,
  27.    Free:  LongInt;
  28. begin
  29.    Regs.AH := $36;
  30.    Regs.DL := DriveCode;
  31.    MSDos(Regs);
  32.  
  33.    {************* Obtaining Infos ******************}
  34.    SectorsPerCLuster:= Regs.AX;
  35.    AvailableClusters:= Regs.BX;
  36.    BytesPerSEctor   := Regs.CX;
  37.    ClustersPerDrive := Regs.DX;
  38.  
  39.    {************* Calculations ********************)
  40.    AllocationSize   := BytesPerSector * SectorsPerCluster;
  41.    Capacity := SectorsPerCluster * BytesPerSector * ClustersPerDrive;
  42.    Free     := SectorsPerCLuster * AvailableClusters * BytesPerSector;
  43.  
  44.    {************* Display *************************}
  45.    Writeln(' Sectors Per Cluster   = ',SectorsPerCluster:15,'');
  46.    Writeln(' Available Clusters    = ',AvailableClusters:15,'');
  47.    Writeln(' Bytes Per Sector      = ',BytesPerSector:15,'');
  48. (63 min left), (H)elp, More?    Writeln(' Clusters Per Drive    = ',ClustersPerDrive:15,'');
  49.    Writeln(' Allocation Size       = ',AllocationSize:15,' Bytes');
  50.    Writeln(' Drive Capacity        = ',Capacity:15,' Bytes');
  51.    Writeln(' Free Space            = ',Free:15,' Bytes');
  52. end;
  53.  
  54. begin
  55.    ClrScr;
  56.    DiskFreeSpace(0);   {Get Current Drive Info}
  57.    readln;
  58. end.
  59.  
  60.  
  61. ----------------------------- Cut ----------------------------------
  62.  
  63.  The above should be ready to run as I have tested on my computer..
  64.  It's got more infos..  I was learning it as I was typing it in so I
  65.  made it more than what you need.
  66.  hope this is what you wanted to know...
  67.  
  68.                                                         Eric
  69.  
  70. ---
  71. (63 min left), (H)elp, More?  ■ OLX 2.1 TD ■ It's only a hobby ... only a hobby ... only a
  72.  * Casino Bulletin Board * Hammonton/Atlantic City NJ U.S.A. 1-609-561-3377
  73.  * PostLink(tm) v1.05  CASINO (#18) : RelayNet(tm)
  74.  
  75. (63 min left), (H)elp, end of Message Command?